import 'package:app_admin/extension/custom_ext.dart';
import 'package:app_admin/pages/orderPlanAdd/orderPlan_add_logic.dart';
import 'package:app_admin/res/images.dart';
import 'package:app_admin/res/styles.dart';
import 'package:app_admin/widgets/title_bar.dart';
import 'package:app_admin/widgets/touch_close_keyboard.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class OrderPlanAddPage extends StatelessWidget {
  final logic = Get.find<OrderPlanAddLogic>();

  OrderPlanAddPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: TitleBar.backAndSave(
          title: "生成生产计划",
          backgroundColor: Styles.c_0089FF,
          onAddFun: () => {logic.btnSave(context)},
        ),
        backgroundColor: Styles.c_F8F9FA,
        body: TouchCloseSoftKeyboard(
            isGradientBg: true,
            child: SingleChildScrollView(
                child: Obx(() => Column(children: [
                      Container(
                        alignment: Alignment.centerLeft,
                        margin: EdgeInsets.fromLTRB(0.w, 0, 0.w, 0), //内边距
                        //padding: EdgeInsets.all(10.w),
                        color: Styles.c_FFFFFF,
                        child: Column(children: [
                          20.verticalSpace,
                          Row(children: [
                            10.horizontalSpace,
                            ImageRes.wajueji.toImage
                              ..width = 40.w
                              ..height = 40.h,
                            "挖掘机派遣计划:".toText..style = Styles.ts_0C1C33_12sp,
                          ]),
                          30.verticalSpace,
                          Row(
                              mainAxisAlignment: MainAxisAlignment.start,
                              mainAxisSize: MainAxisSize.max,
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: [
                                Container(
                                  //color: Colors.black,
                                  width: 120.w,
                                  alignment: Alignment.centerRight,
                                  child: "设置订货日期:".toText
                                    ..style = Styles.ts_0C1C33_12sp,
                                ),
                                10.horizontalSpace,
                                Flexible(
                                    child: GestureDetector(
                                        behavior: HitTestBehavior.translucent,
                                        onTap: logic.openDatePicker,
                                        child: Container(
                                          height: 42.h,
                                          padding: EdgeInsets.only(
                                              left: 12.w, right: 8.w),
                                          decoration: BoxDecoration(
                                            border: Border.all(
                                                color: Styles.c_E8EAEF,
                                                width: 1),
                                            borderRadius:
                                                BorderRadius.circular(8.r),
                                          ),
                                          child: Row(
                                            crossAxisAlignment:
                                                CrossAxisAlignment.center,
                                            children: [
                                              Expanded(
                                                child: logic.time.value.toText
                                                  ..style =
                                                      Styles.ts_0C1C33_12sp,
                                              ),
                                              ImageRes.calendar.toImage
                                                ..width = 24.w
                                                ..height = 24.h,
                                            ],
                                          ),
                                        ))),
                                50.horizontalSpace,
                              ]),
                          20.verticalSpace,
                          Row(
                              mainAxisAlignment: MainAxisAlignment.start,
                              mainAxisSize: MainAxisSize.max,
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: [
                                Container(
                                  //color: Colors.black,
                                  width: 120.w,
                                  alignment: Alignment.centerRight,
                                  child: "出矿采场:".toText
                                    ..style = Styles.ts_0C1C33_12sp,
                                ),
                                10.horizontalSpace,
                                Flexible(
                                    child: GestureDetector(
                                        behavior: HitTestBehavior.translucent,
                                        onTap: () => {
                                              logic.openStartNameSelect(context)
                                            },
                                        child: Container(
                                          height: 42.h,
                                          width: 200.w,
                                          padding: EdgeInsets.only(
                                              left: 12.w, right: 8.w),
                                          decoration: BoxDecoration(
                                            border: Border.all(
                                                color: Styles.c_E8EAEF,
                                                width: 1),
                                            borderRadius:
                                                BorderRadius.circular(8.r),
                                          ),
                                          child: Row(
                                            crossAxisAlignment:
                                                CrossAxisAlignment.center,
                                            children: [
                                              Expanded(
                                                child:
                                                    logic.startName.value.toText
                                                      ..style =
                                                          Styles.ts_0C1C33_12sp,
                                              ),
                                              ImageRes.downArrow.toImage
                                                ..width = 24.w
                                                ..height = 24.h,
                                            ],
                                          ),
                                        ))),
                                50.horizontalSpace,
                              ]),
                          20.verticalSpace,
                          Row(
                              mainAxisAlignment: MainAxisAlignment.start,
                              mainAxisSize: MainAxisSize.max,
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: [
                                Container(
                                  //color: Colors.black,
                                  width: 120.w,
                                  alignment: Alignment.centerRight,
                                  child: "工作面:".toText
                                    ..style = Styles.ts_0C1C33_12sp,
                                ),
                                10.horizontalSpace,
                                Flexible(
                                    child: GestureDetector(
                                        behavior: HitTestBehavior.translucent,
                                        onTap: () =>
                                            {logic.openworkNameSelect(context)},
                                        child: Container(
                                          height: 42.h,
                                          width: 200.w,
                                          padding: EdgeInsets.only(
                                              left: 12.w, right: 8.w),
                                          decoration: BoxDecoration(
                                            border: Border.all(
                                                color: Styles.c_E8EAEF,
                                                width: 1),
                                            borderRadius:
                                                BorderRadius.circular(8.r),
                                          ),
                                          child: Row(
                                            crossAxisAlignment:
                                                CrossAxisAlignment.center,
                                            children: [
                                              Expanded(
                                                child:
                                                    logic.workName.value.toText
                                                      ..style =
                                                          Styles.ts_0C1C33_12sp,
                                              ),
                                              ImageRes.downArrow.toImage
                                                ..width = 24.w
                                                ..height = 24.h,
                                            ],
                                          ),
                                        ))),
                                50.horizontalSpace,
                              ]),
                          20.verticalSpace,
                          Row(
                              mainAxisAlignment: MainAxisAlignment.start,
                              mainAxisSize: MainAxisSize.max,
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: [
                                Container(
                                  //color: Colors.black,
                                  width: 120.w,
                                  alignment: Alignment.centerRight,
                                  child: "卸矿点:".toText
                                    ..style = Styles.ts_0C1C33_12sp,
                                ),
                                10.horizontalSpace,
                                Flexible(
                                    child: GestureDetector(
                                        behavior: HitTestBehavior.translucent,
                                        onTap: () =>
                                            {logic.openendNameSelect(context)},
                                        child: Container(
                                          height: 42.h,
                                          width: 200.w,
                                          padding: EdgeInsets.only(
                                              left: 12.w, right: 8.w),
                                          decoration: BoxDecoration(
                                            border: Border.all(
                                                color: Styles.c_E8EAEF,
                                                width: 1),
                                            borderRadius:
                                                BorderRadius.circular(8.r),
                                          ),
                                          child: Row(
                                            crossAxisAlignment:
                                                CrossAxisAlignment.center,
                                            children: [
                                              Expanded(
                                                child:
                                                    logic.endName.value.toText
                                                      ..style =
                                                          Styles.ts_0C1C33_12sp,
                                              ),
                                              ImageRes.downArrow.toImage
                                                ..width = 24.w
                                                ..height = 24.h,
                                            ],
                                          ),
                                        ))),
                                50.horizontalSpace,
                              ]),
                          20.verticalSpace,
                          Row(
                              mainAxisAlignment: MainAxisAlignment.start,
                              mainAxisSize: MainAxisSize.max,
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: [
                                Container(
                                  //color: Colors.black,
                                  width: 120.w,
                                  alignment: Alignment.centerRight,
                                  child: "挖掘机:".toText
                                    ..style = Styles.ts_0C1C33_12sp,
                                ),
                                10.horizontalSpace,
                                Flexible(
                                    child: GestureDetector(
                                        behavior: HitTestBehavior.translucent,
                                        onTap: () =>
                                            {logic.opencarSelect(context)},
                                        child: Container(
                                          height: 100.h,
                                          width: 200.w,
                                          padding: EdgeInsets.only(
                                              left: 12.w, right: 8.w),
                                          decoration: BoxDecoration(
                                            border: Border.all(
                                                color: Styles.c_E8EAEF,
                                                width: 1),
                                            borderRadius:
                                                BorderRadius.circular(8.r),
                                          ),
                                          child: Row(
                                            crossAxisAlignment:
                                                CrossAxisAlignment.center,
                                            children: [
                                              Expanded(
                                                child: logic.car.value.toText
                                                  ..style =
                                                      Styles.ts_0C1C33_12sp,
                                              ),
                                              ImageRes.moreBlack.toImage
                                                ..width = 24.w
                                                ..height = 24.h,
                                            ],
                                          ),
                                        ))),
                                50.horizontalSpace,
                              ]),
                          20.verticalSpace,
                        ]),
                      ),
                      20.verticalSpace,
                      Container(
                        alignment: Alignment.centerLeft,
                        margin: EdgeInsets.fromLTRB(0.w, 0, 0.w, 0), //内边距
                        //padding: EdgeInsets.all(10.w),
                        color: Styles.c_FFFFFF,
                        child: Column(children: [
                          10.verticalSpace,
                          Row(children: [
                            10.horizontalSpace,
                            ImageRes.kuangche.toImage
                              ..width = 40.w
                              ..height = 40.h,
                            "挖掘机派遣计划:".toText..style = Styles.ts_0C1C33_12sp,
                          ]),
                          20.verticalSpace,
                        ]),
                      ),
                    ])))));
  }
}
